#include "EquationSolver.hpp"
#include <iostream>

using namespace std; 

class F : public Function{
public:
    double operator() (double x) const{
        return x-tan(x);
    }
    double derivative(double x) const{
        return 1-1/(pow(cos(x),2));
    }
}f;

void solve_F1() {
    cout << "Solving x-tan(x) near 4.5" << endl;
    Newton_Method solver_f1(F(),4.5);
    double x = solver_f1.solve();
    cout << "A root is :" << x << endl;
    cout << "Error is :" << f(x) << endl;
}

void solve_F2() {
    cout << "Solving x-tan(x) near 7.7" << endl;
    Newton_Method solver_f2(F(),7.7);
    double x = solver_f2.solve();
    cout << "A root is :" << x << endl;
    cout << "Error is :" << f(x) << endl;
}

int main() {
    solve_F1();
    solve_F2();
    return 0;
}